
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <title>指标钻取事件 · GitBook</title>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.0.0">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="explain-summary.html" />
    
    
    <link rel="prev" href="explain-property2.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    平台概念介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="plugin-intro.html">
            
                <a href="plugin-intro.html">
            
                    
                    指标开发简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="plugin-file.html">
            
                <a href="plugin-file.html">
            
                    
                    插件目录结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="plugin-conf.html">
            
                <a href="plugin-conf.html">
            
                    
                    插件配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="plugin-review.html">
            
                <a href="plugin-review.html">
            
                    
                    插件开发说明
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="explain-intro.html">
            
                <a href="explain-intro.html">
            
                    
                    指标开发讲解
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="explain-bootstrap.html">
            
                <a href="explain-bootstrap.html">
            
                    
                    指标核心逻辑
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="explain-property1.html">
            
                <a href="explain-property1.html">
            
                    
                    指标通用属性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="explain-property2.html">
            
                <a href="explain-property2.html">
            
                    
                    指标自定义属性
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.3.4" data-path="explain-event.html">
            
                <a href="explain-event.html">
            
                    
                    指标钻取事件
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="explain-summary.html">
            
                <a href="explain-summary.html">
            
                    
                    指标开发总结
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >指标钻取事件</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6307;&#x6807;&#x94BB;&#x53D6;&#x4E8B;&#x4EF6;">&#x6307;&#x6807;&#x94BB;&#x53D6;&#x4E8B;&#x4EF6;</h1>
<hr>
<p>&#x6307;&#x6807;&#x5E73;&#x53F0;&#x652F;&#x6301;&#x6570;&#x636E;&#x7684;&#x94BB;&#x53D6;&#x64CD;&#x4F5C;&#xFF0C;&#x8FD9;&#x5305;&#x62EC;&#x5F53;&#x524D;&#x9875;&#x9762;&#x7684;&#x94BB;&#x53D6;&#x8FC7;&#x6EE4;&#x4E0E;&#x8DF3;&#x8F6C;&#x5230;&#x65B0;&#x9875;&#x9762;&#x7684;&#x94BB;&#x53D6;&#x8FC7;&#x6EE4;&#x4E24;&#x79CD;&#x65B9;&#x5F0F;&#xFF0C;&#x5176;&#x5B9E;&#x8FD9;&#x4E24;&#x79CD;&#x65B9;&#x5F0F;&#x5728;&#x903B;&#x8F91;&#x5904;&#x7406;&#x4E0A;&#x662F;&#x4E00;&#x6837;&#x7684;&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x901A;&#x8FC7;&#x8BBE;&#x7F6E;&#x8FC7;&#x7A0B;&#x8BE6;&#x7EC6;&#x8BF4;&#x660E;&#x4E00;&#x4E0B;&#x6307;&#x6807;&#x5E73;&#x53F0;&#x5982;&#x4F55;&#x652F;&#x6301;&#x670D;&#x52A1;&#x5668;&#x7AEF;&#x6570;&#x636E;&#x8FC7;&#x6EE4;&#x7279;&#x6027;&#x7684;&#xFF1A;</p>
<ul>
<li>&#x4EE5;&#x6570;&#x636E;&#x6E90;&#x7C7B;&#x578B;&#x4E3A;DATABASE&#x4E3A;&#x4F8B;&#xFF0C;&#x9996;&#x5148;&#x9700;&#x8981;&#x6784;&#x5EFA;&#x5E26;&#x6709;&#x53C2;&#x6570;&#x6807;&#x8BC6;&#x7684;TSQL&#xFF08;&#x53C2;&#x6570;&#x89C4;&#x5219;&#x53EF;&#x53C2;&#x89C1;&#x8BBE;&#x8BA1;&#x5668;&#x4E2D;&#x7684;&#x8BF4;&#x660E;&#xFF09;&#x3002;</li>
</ul>
<p><img src="images/pivot-sql.png" alt="SqlParam" title="&#x53C2;&#x6570;&#x8BBE;&#x7F6E;"></p>
<ul>
<li>&#x7136;&#x540E;&#x8BBE;&#x7F6E;&#x53C2;&#x6570;&#x7684;&#x53C2;&#x6570;&#x7C7B;&#x578B;&#x4E0E;&#x9ED8;&#x8BA4;&#x503C;&#x3002;</li>
</ul>
<p><img src="images/pivot-param.png" alt="SqlParam" title="&#x53C2;&#x6570;&#x8BBE;&#x7F6E;"></p>
<ul>
<li>&#x6700;&#x540E;&#x5728;&#x6307;&#x6807;&#x8BBE;&#x8BA1;&#x4E2D;&#x901A;&#x8FC7;&#x6307;&#x6807;&#x63D2;&#x4EF6;&#x63D0;&#x4F9B;&#x7684;&#x94BB;&#x53D6;&#x8BBE;&#x7F6E;&#x5C06;&#x6307;&#x6807;&#x7684;&#x4E8B;&#x4EF6;&#x53C2;&#x6570;&#x4E0E;&#x6570;&#x636E;&#x96C6;&#x7684;&#x53C2;&#x6570;&#x5339;&#x914D;&#xFF08;&#x9875;&#x9762;&#x4E2D;&#x7684;&#x53C2;&#x6570;&#x5217;&#x8868;&#x4E3A;&#x5F53;&#x524D;&#x9875;&#x9762;&#x7684;&#x6240;&#x6709;&#x6307;&#x6807;&#x5173;&#x8054;&#x7684;&#x6570;&#x636E;&#x96C6;&#x53C2;&#x6570;&#x7684;&#x96C6;&#x5408;&#xFF09;&#x3002;</li>
</ul>
<p><img src="images/pivot-event.png" alt="SqlParam" title="&#x53C2;&#x6570;&#x8BBE;&#x7F6E;"></p>
<hr>
<p>&#x5B9E;&#x9645;&#x4E0A;&#xFF0C;&#x6307;&#x6807;&#x7684;&#x4E8B;&#x4EF6;&#x652F;&#x6301;&#x8FD8;&#x662F;&#x5F88;&#x7B80;&#x5355;&#x7684;&#xFF0C;&#x5BF9;&#x4E8E;&#x81EA;&#x5B9A;&#x4E49;&#x5C5E;&#x6027;&#x7F16;&#x8F91;&#x5668;&#x7684;&#x5B9E;&#x73B0;&#x65B9;&#x5F0F;&#x5982;&#x4E0B;&#xFF1A;</p>
<p><em>editorJs</em> &#x589E;&#x52A0;&#x5982;&#x4E0B;&#x4EE3;&#x7801;</p>
<pre><code>$scope.eventSelect = function () {
    $scope.bindPivotEvent({
        Event:&quot;SeriesClick&quot;,
        Params:[
            {Value:&quot;SeriesName&quot;,Name:&quot;&#x5E8F;&#x5217;&#x540D;&#x79F0;&quot;},
            {Value:&quot;Dimension&quot;,Name:&quot;&#x5E8F;&#x5217;&#x7EF4;&#x5EA6;&#x503C;&quot;},
            {Value:&quot;Measure&quot;,Name:&quot;&#x5E8F;&#x5217;&#x5EA6;&#x91CF;&#x503C;&quot;}
        ]
    });
};
</code></pre><p><em>editorTpl</em> &#x589E;&#x52A0;&#x5982;&#x4E0B;&#x4EE3;&#x7801;</p>
<pre><code>&lt;div class=&quot;row chart-pivot-event&quot;&gt;
    &lt;div class=&quot;col-xs-6&quot;&gt;
        &lt;div class=&quot;form-group&quot;&gt;
            &lt;label class=&quot;control-label col-xs-3&quot;&gt;&#x94BB;&#x53D6;&#x8BBE;&#x7F6E;&lt;/label&gt;
            &lt;div class=&quot;col-xs-9&quot;&gt;
                &lt;button class=&quot;btn btn-default&quot; ng-click=&quot;eventSelect()&quot;&gt;&#x5E8F;&#x5217;&#x70B9;&#x51FB;&#x4E8B;&#x4EF6;&lt;/button&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre><hr>
<p>&#x5BF9;&#x4E8E;&#x901A;&#x7528;&#x5C5E;&#x6027;&#x7684;&#x65B9;&#x5F0F;&#x66F4;&#x4E3A;&#x7B80;&#x5355;&#xFF0C;&#x5728;&#x901A;&#x7528;&#x5C5E;&#x6027;&#x4E2D;&#x5B9A;&#x4E49;&#x7C7B;&#x4F3C;&#x7684;&#x5C5E;&#x6027;&#x6807;&#x8BC6;&#xFF1A;</p>
<pre><code>{
    group: &apos;&#x4E8B;&#x4EF6;&apos;,
    id: &apos;6122971c-a8f3-4a02-a497-e4e3e351bb1c&apos;,
    name: &apos;&#x5E8F;&#x5217;&#x70B9;&#x51FB;&#x4E8B;&#x4EF6;&apos;,
    enable: true,
    type: &apos;pivotEvent&apos;,
    value: {
        Event:&quot;SeriesClick&quot;,
        Params:[
            {Value:&quot;SeriesName&quot;,Name:&quot;&#x5E8F;&#x5217;&#x540D;&#x79F0;&quot;},
            {Value:&quot;Dimension&quot;,Name:&quot;&#x5E8F;&#x5217;&#x7EF4;&#x5EA6;&#x503C;&quot;},
            {Value:&quot;Measure&quot;,Name:&quot;&#x5E8F;&#x5217;&#x5EA6;&#x91CF;&#x503C;&quot;}
        ]
    },
    tooltip: &apos;&#x5E8F;&#x5217;&#x70B9;&#x51FB;&#x4E8B;&#x4EF6;&#xFF0C;&#x94BB;&#x53D6;&#x8BBE;&#x7F6E;&apos;
}
</code></pre><hr>
<p>&#x6307;&#x6807;&#x6838;&#x5FC3;&#x4EE3;&#x7801;&#x7684;&#x5BF9;&#x5E94;&#x5904;&#x7406;&#x903B;&#x8F91;&#x53C2;&#x8003;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre><code>_bindEvent: function () {
    var _this = this;
    this._chart.on(&quot;click&quot;, function (param) {
        if (_this._layout
            &amp;&amp; _this._layout.navigate
            &amp;&amp; _this._option.Events
            &amp;&amp; _this._option.Events.length &gt; 0) {

            var registerEvent = _.findWhere(_this._option.Events, {Event: &quot;SeriesClick&quot;});
            if (registerEvent) {
                var pageId = registerEvent.PageId;
                var params = registerEvent.Params;
                var args = [];
                var dParam = _.findWhere(params, {Value: &quot;Dimension&quot;});
                if (dParam &amp;&amp; dParam.ParamName) {
                    args.push({
                        ParamName: dParam.ParamName,
                        ParamValue: param.name
                    });
                }
                var mParam = _.findWhere(params, {Value: &quot;Measure&quot;});
                if (mParam &amp;&amp; mParam.ParamName) {
                    args.push({
                        ParamName: mParam.ParamName,
                        ParamValue: param.value
                    });
                }
                var sParam = _.findWhere(params, {Value: &quot;SeriesName&quot;});
                if (sParam &amp;&amp; sParam.ParamName) {
                    args.push({
                        ParamName: sParam.ParamName,
                        ParamValue: param.seriesName
                    });
                }
                _this._layout.navigate(pageId, args);

            }
            param.event.event.preventDefault();
        }
    });
}
</code></pre><p>&#x5176;&#x5173;&#x952E;&#x90E8;&#x5206;&#x662F;&#x8C03;&#x7528;<code>layout</code>&#x5BF9;&#x8C61;&#xFF08;&#x5E03;&#x5C40;&#x5BF9;&#x8C61;&#xFF09;&#x7684;<code>navigate</code>&#x65B9;&#x6CD5;&#xFF0C;&#x5E76;&#x6839;&#x636E;&#x5B9E;&#x9645;&#x8BBE;&#x7F6E;&#x60C5;&#x51B5;&#x4F20;&#x5165;<code>pageId</code>&#xFF08;&#x9875;&#x9762;ID&#xFF09;&#x548C;<code>args</code>&#xFF08;&#x8FC7;&#x6EE4;&#x53C2;&#x6570;&#xFF09;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="explain-property2.html" class="navigation navigation-prev " aria-label="Previous page: 指标自定义属性">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="explain-summary.html" class="navigation navigation-next " aria-label="Next page: 指标开发总结">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"指标钻取事件","level":"1.3.4","depth":2,"next":{"title":"指标开发总结","level":"1.4","depth":1,"path":"explain-summary.md","ref":"explain-summary.md","articles":[]},"previous":{"title":"指标自定义属性","level":"1.3.3","depth":2,"path":"explain-property2.md","ref":"explain-property2.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"explain-event.md","mtime":"2016-05-27T03:33:08.746Z","type":"markdown"},"gitbook":{"version":"3.0.0","time":"2018-08-30T06:38:59.990Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/buttons.js"></script>
        
    

    </body>
</html>

